
#include "MayEvent/arg.hpp"

using namespace std;

template<class T>
Argobj<T>::Argobj()
{
}

template<class T>
Argobj<T>::~Argobj()
{
}

template<class T>
void Argobj<T>::addArgument(std::string name, const T val)
{
    this->args.insert({ name, val });
}

template<class T>
int Argobj<T>::getArgument(string name, T* ret)
{
    if (this->args.count(name))
    {
        *ret = this->args.find(name)->second;
        return 0;
    }
    return -1;
}

template<class T>
size_t Argobj<T>::getArgumentCount()
{
    return this->args.size();
}

template<typename T>
Argobj<T>& getArgobj(PARGOBJ ptr)
{
    return *(Argobj<T>*)ptr.get();
}


// 特化
template class Argobj<int>;
template class Argobj<float>;
template class Argobj<double>;
template class Argobj<string>;
template class Argobj<char>;
template class Argobj<ArgPoiner>;
template class Argobj<bool>;
template class Argobj<unsigned int>;

template Argobj<int>& getArgobj(PARGOBJ ptr);
template Argobj<float>& getArgobj(PARGOBJ ptr);
template Argobj<double>& getArgobj(PARGOBJ ptr);
template Argobj<string>& getArgobj(PARGOBJ ptr);
template Argobj<char>& getArgobj(PARGOBJ ptr);
template Argobj<ArgPoiner>& getArgobj(PARGOBJ ptr);
template Argobj<bool>& getArgobj(PARGOBJ ptr);
template Argobj<unsigned int>& getArgobj(PARGOBJ ptr);
